package cn.hahah.module.blog.dal.mysql.tag;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.tag.TagDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.tag.vo.*;

/**
 * 博客系统标签 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TagMapper extends BaseMapperX<TagDO> {

    default PageResult<TagDO> selectPage(TagPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TagDO>()
                .eqIfPresent(TagDO::getId, reqVO.getId())
                .likeIfPresent(TagDO::getTname, reqVO.getTname())
                .likeIfPresent(TagDO::getCname, reqVO.getCname())
                .eqIfPresent(TagDO::getDescription, reqVO.getDescription())
                .eqIfPresent(TagDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(TagDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TagDO::getId));
    }

}